from selenium import webdriver
from time import  sleep
from selenium.webdriver import ActionChains

bro = webdriver.Chrome(executable_path='./chromedriver.exe')
bro.get('https://www.runoob.com/try/try.php?filename=jqueryui-api-droppable')

#如果定位的标签是存在于iframe标签之中的则必须通过如下操作在进行标签定位
bro.switch_to.frame('iframeResult')#切换浏览器标签定位的作用域
div = bro.find_element_by_id('draggable')


#动作链
action = ActionChains(bro)
#点击长安指定的标签
action.click_and_hold(div)

for i in range(5):
    #perform()立即执行动作链操作
    #move参数由水平和竖直方向决定
    action.move_by_offset(17,0).perform()
    sleep(0.3)

#释放动作量
action.release()

bro.quit()